

//防止sql注入
const base={
  detSql:function(param){
    re= /select|update|delete|exec|count|'|"|=|;|>|<|%/i;
      if ( re.test(param) ){

        return false;
      }
      return true;
  },
  empty_b:function(param){

    if(param==null||param==""||param==undefined||param=="undefined"||param=="null")   return false;

    return param
  },
  Log_Verify:function(that){
       if(!base.empty_b(localStorage.userinfo)){
       
        return false
       }
       return true
  },
  head_status:function(num){
    
   try {  
     
    if(base.empty_b(api)){
    
      $api.fixStatusBar(document.getElementsByClassName("van-nav-bar")[0])

      api.setStatusBarStyle({ color: "white" });
      if(num==1){
        if(document.getElementsByClassName("van-nav-bar").length==1){
          
          document.getElementById("cust_head").style.height=(document.getElementsByClassName("van-nav-bar")[0].offsetHeight+10)+"px"
      }
      }
   
    
   }
   } catch (error) {
    //  console.log("head_status报错了"+JSON.stringify(error))   
   }
  },
  formatDate:function(timestamp){
    var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
		var Y = date.getFullYear() + '-';
		var M = date.getMonth()>=10?(date.getMonth()+1)+'-':'0'+(date.getMonth()+1)+'-'; 
		var D = date.getDate()>=10?date.getDate()+' ':'0'+date.getDate()+ ' ';
		var h = date.getHours()>=10?date.getHours()+':':'0'+date.getHours()+':';
		var m = date.getMinutes()>=10?date.getMinutes()+':':'0'+date.getMinutes()+':'; 
    var s = date.getSeconds()>=10?date.getSeconds():'0'+date.getSeconds();

		return M+D+h+m+s;

  }


}




module.exports=base;


